1. Technical Field
The present invention relates in general to a system and method for improving memory usage for Java executable (JXE) files. More particularly, the present invention relates to a system and method for memory mapping the read-only portion of the JXE file so that the operating system can reclaim the memory when needed.
2. Description of the Related Art
Pervasive computing devices are available to perform a wide variety of tasks in today's business arena. Semiconductor technology has enabled devices such as mobile telephones and personal digital assistants (PDAs) to perform tasks that, until recently, were reserved for more traditional computers.
These pervasive computing devices include more powerful operating systems. Some of these operating systems support middleware applications, such as “virtual machines” that are adapted to run platform-neutral applications. A popular example of a virtual machine is the Java Virtual Machine (JVM). Programs written to execute using a JVM will operate on any JVM regardless of the underlying hardware and operating system used by the computing device. Underlying operating systems include Microsoft's Windows™ based operating systems as well as Unix-based operating systems such as IBM's AIX operating system and the Linux operating system.
One challenge that is encountered when running an embedded virtual machine on many pervasive computing devices, especially smaller pervasive computing devices, is the smaller amount of available memory on these devices. This challenge is being addressed by the introduction of pre-linked executable images of the applications written for the virtual machine environment. In the Java environment, these pre-linked executable images are referred to as “JXE” files. The Jxe file wraps the Java classes into one executable file, which makes the startup and distribution of Java programs easier.
While using JXE files improves the startup and distribution of Java programs, it adds particular memory challenges. When running a JXE file from a filesystem, the entire JXE image is loaded into memory in order to execute the program. Thus, using JXE files requires the computing device to have sufficient amounts of memory to store and load into RAM all of the bytecodes included in the JXE file. This can be especially challenging when a user is using multiple JXE files on a smaller pervasive computing device, with each JXE file needing to be loaded into the limited amount of available memory.
JXE files include both read-only data, such as the bytecodes, and read/write data, such as the variables used by the program. Because of this, the memory in which the JXE file resides is typically not swappable without first writing all the JXE data stored in memory back to nonvolatile storage, such as a hard disk drive. This is the case even though the read/write portion of the JXE file is often quite small in comparison to the read-only portion of the file. Swapping the entire JXE file out to disk takes considerable computing resources and decreases system performance. In addition, many pervasive computing devices do not have swap space to even allow swapping of the JXE file. Likewise, when the application is subsequently needed, having to read the entire JXE file from disk and load it back into memory is also expensive in terms of time and computing resources.
What is needed, therefore, is a system and method for allowing page faults to occur with the read-only portion of JXE files using an operating system that supports paging. What is further needed is a system and method to load JXE pages when needed and allow the operating system to discard JXE pages according to the system's normal paging process.